// pages/detail/detail.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
          item:{},
          newstar:[]
    },

    onLoad: function (options) {
          var that=this;
          console.log(options)
          wx.request({
                url: 'http://localhost:8080/v2/movie/subject/'+options.id,
                success:function(res){
                      console.log(res.data)
                      var arr2=[];
                      var num = parseInt(Number(res.data.rating.stars) / 10);
                      for (var i = 0; i < 5; i++) {
                            if (i < num) {
                                  arr2.push(1)
                            } else {
                                  arr2.push(0)
                            }
                      }
                      
                        that.setData({
                              item:res.data,
                              newstar:arr2
                        })
                        wx.setNavigationBarTitle({
                              title: res.data.title,
                        })
                }
          })
    }

})